fix(search): fan out only over values the leaf can read - #828
Open
ddeboer wants to merge 1 commit into
Open
Conversation
Found adapting a downstream schema to ADR 26, against its real data. A role is sometimes stated twice on one node – as a string and as a Wikidata entity – and a keyword leaf reads the literal and passes over the IRI. Fan-out split on both, so the IRI minted a second entry the role was absent from: the same endpoint, apparently in no role at all, shown to a reader and matched by a filter. The split now follows the reader. Only `keyword` needs narrowing: a `text` field has no filter operator, so nothing welds it and it is never a tuple position, and a `reference` is one whose two shapes are both meaningful – an IRI, and a node the graph named inline, which has no IRI and is a referent all the same.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #801, found while adapting Linked Open Limburg’s schema to ADR 26 against its real data.
The defect
A role is sometimes stated twice on one node – once as a string, once as a Wikidata entity. Beeld & Geluid does this, and LOL’s own schema comment noted the IRI “costs nothing and takes nothing away”, which was true while the entry held a list.
Under fan-out it stopped being true.
tuplesOfsplit on every framed value, but akeywordleaf reads literals and passes over an IRI – so the IRI minted a second entry the role was absent from:The same endpoint, apparently in no role at all – shown to a reader, and matched by a filter for that agent. Not a crash and not a hang: a phantom entry that reads as data.
Two things the shape happens to get right, worth stating so the fix is not over-drawn:
keyworddoes drop the IRI, so no rawhttp://…is rendered as a role label, andapplyIdentityCompaniondedupes, so the agent’s id appears once rather than twice.The fix
The split follows the reader.
splittable()narrows a leaf’s framed values to those its kind can read before the product is taken.Only
keywordneeds it:texthas no filter operator (filterOperatorFormaps it toundefined), so nothing welds it and it is never a tuple position;referenceis one, and both of its shapes are meaningful – an IRI, and, for alocallookup, a node the graph named inline, which has no IRI and is a referent all the same.Notes
limburg/lol, its issue 162) is what surfaced this. It needs@lde/search@0.25.0plus this fix.